home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / SNNSV32.ZIP / SNNSv3.2 / xgui / sources / ui_textP.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-25  |  2.1 KB  |  105 lines

  1. /*****************************************************************************
  2.   FILE           : ui_textP.c
  3.   SHORTNAME      : textP.c
  4.   SNNS VERSION   : 3.2
  5.  
  6.   PURPOSE        :
  7.   NOTES          :
  8.  
  9.   AUTHOR         : Tilman Sommer
  10.   DATE           : 1.2.1990
  11.  
  12.   CHANGED BY     :
  13.   IDENTIFICATION : @(#)ui_textP.c    1.10 4/18/94
  14.   SCCS VERSION   : 1.10
  15.   LAST CHANGE    : 4/18/94
  16.  
  17.              Copyright (c) 1990-1994  SNNS Group, IPVR, Univ. Stuttgart, FRG
  18.              
  19. ******************************************************************************/
  20.  
  21. #include <stdio.h>
  22. #include <string.h>
  23.  
  24. #include "ui.h"
  25. #include "ui_confirmer.h"
  26.  
  27. #include "ui_fileP.h"
  28. #include "ui_textP.ph"
  29.  
  30.  
  31. /*****************************************************************************
  32.   FUNCTION : ui_tw_errorMessage()
  33.  
  34.   PURPOSE  : prints error messages into a confirmer
  35.   RETURNS  : void
  36.   NOTES    :
  37.  
  38.   UPDATE   : 10.12.1991
  39. ******************************************************************************/
  40.  
  41. void ui_tw_errorMessage(char *message)
  42.  
  43. {
  44.     char error[512];
  45.     char *cptr, *temp;
  46.     int max_len = 40;
  47.     int best_len, str_len, i;
  48.  
  49.     strcpy (error, message);
  50.     str_len = strlen(error);
  51.     if (str_len == 0)
  52.         return;
  53.     best_len = str_len DIV (((str_len - 1) DIV max_len) + 1);
  54.     cptr = error;
  55.     i = 0;
  56.     while (*cptr != '\0') {
  57.        cptr++;
  58.        i++;
  59.        if (i == best_len) {
  60.            temp = cptr;
  61.            while (*temp != ' ')
  62.                temp--;
  63.            *temp = '\n';
  64.            i = (int) (cptr - temp);
  65.        }
  66.     }
  67.     ui_confirmOk (error);
  68.     if (ui_textFilePtr != NULL) {
  69.     fprintf(ui_textFilePtr, "%s\n", message);
  70.     fflush(ui_textFilePtr);
  71.     }
  72. }
  73.  
  74.  
  75. /*****************************************************************************
  76.   FUNCTION : ui_tw_printMessage()
  77.  
  78.   PURPOSE  :
  79.   RETURNS  :
  80.   NOTES    :
  81.  
  82.   UPDATE   : 1.2.1990
  83. ******************************************************************************/
  84.  
  85. void ui_tw_printMessage(char *message)
  86.  
  87. {
  88.     printf(message);
  89.     if (ui_textFilePtr != NULL) {
  90.     fprintf(ui_textFilePtr, message);
  91.     fflush(ui_textFilePtr);
  92.     }
  93. }
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103. /* end of file */
  104. /* lines: 103 */
  105.